package main;

import java.io.IOException;
import server.ForumServer;
import server.WSEPHandler;

public class ServerMain{

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		System.out.println("starting server main...");
		ForumServer server = ForumServer.getInstance();
		try {
			jaxcentServer.ServerMain webserver = new jaxcentServer.ServerMain (80, "web/html/", "web/html/ajax_config.xml", null);
			webserver.start();
		} catch (IOException e1) {
			System.out.println("jaxcent failed: "+e1.getMessage());
		}
		
		while (true) {
			try {
				System.out.println("Swing Server is listening on port "+ server.get_port());
				final WSEPHandler wsepHandler = new WSEPHandler(server.get_serverSocket().accept(),server);
				wsepHandler.start();
			} catch (Exception e) {
				System.out.println("Problems with server");
			}
		}

	}
}